/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pl.edu.amu.wmi.kino.visualjavafx.javafxcodegenerators.helpergenerators;

import pl.edu.amu.wmi.kino.visualjavafx.model.animation.transformations.Movable;

/**
 *
 * @author Admin
 */
public class TransformGenerator {
    public static String transX="translateX";
    public static String transY="translateY";
    public static String angle="rotateAngle";
    public static String anchorX="rotateAnchorX";
    public static String anchorY="rotateAnchorY";
    public static String scaleX="scaleX";
    public static String scaleY="scaleY";
    public static String skewX="skewX";
    public static String skewY="skewY";

    public static void generateTransformAttributes(StringBuilder sb,int recursionLevel){
        sb.append("override attribute transform=bind[Transform.translate("+
                transX+recursionLevel+","+transY+recursionLevel+"),\n");
        sb.append("Transform.rotate("+angle+recursionLevel+","+
                anchorX+recursionLevel+","+anchorY+recursionLevel+"),\n");
        sb.append("Transform.scale("+scaleX+recursionLevel+","+scaleY+recursionLevel+"),\n");
        sb.append("Transform.skew("+skewX+recursionLevel+","+skewY+recursionLevel+")]\n");
    }
    public static void generateTransformVars(StringBuilder sb,Movable o,int recursionLevel){
        sb.append("var "+transX+recursionLevel+"=0.0;\n");
        sb.append("var "+transY+recursionLevel+"=0.0;\n");
        sb.append("var "+angle+recursionLevel+"="+o.getRotation()+";\n");
        sb.append("var "+anchorX+recursionLevel+"="+(o.getHCenterDelta()+o.getHPos())+";\n");
        sb.append("var "+anchorY+recursionLevel+"="+(o.getVCenterDelta()+o.getVPos())+";\n");
        sb.append("var "+scaleX+recursionLevel+"=1.0;\n");
        sb.append("var "+scaleY+recursionLevel+"=1.0;\n");
        sb.append("var "+skewX+recursionLevel+"=0.0;\n");
        sb.append("var "+skewY+recursionLevel+"=0.0;\n");
    }
}
